package de.justphil.tcg.tcgandroidclient.gui;

import de.justphil.tcg.tcgandroidclient.R;
import de.justphil.tcg.tcgandroidclient.Storage;
import de.justphil.tcg.tcgandroidclient.content.TCGUM;
import de.justphil.tcg.tcgandroidclient.gui.cardfinder.CardFinderAct;
import de.justphil.tcg.tcgandroidclient.gui.decks.DecksAct;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class CardsAct extends Activity {

	private Button decksButton;
	private Button repositoryButton;
	private Button cardFinderButton;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
	
		super.onCreate(savedInstanceState);
		setContentView(R.layout.cards);
		initializeComponents();
	}
	
	
	private void initializeComponents(){
		
		decksButton = (Button) findViewById(R.id.cards_button_decks);
		repositoryButton = (Button) findViewById(R.id.cards_button_repository);
		cardFinderButton = (Button) findViewById(R.id.cards_button_cardFinder);

		decksButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
			
				Intent intent = new Intent(CardsAct.this, DecksAct.class);
				intent.setData(TCGUM.getDecksUri(Storage.getPlayerId()));
				startActivity(intent);
			}
			
		});
		repositoryButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(CardsAct.this, DeckCreatorAct.class);
				intent.setData(TCGUM.getCardInstancesUri(Storage.getPlayerId()));
				startActivity(intent);
			}
		});
		cardFinderButton.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
			
				startActivity(new Intent(CardsAct.this, CardFinderAct.class));
			}
		});
	}
	
}
